/**
 * Created by liaoxd on 2017/12/17.
 */
define([
  './custom/widgets/js/YuWorkflow_server.js'
], function (require, exports) {
  // page加载完成后调用ready方法
  exports.ready = function (hashCode, data, cite) {
    var size = yufp.frame.size();
    var serverTypeOptions = [{ key: "C", value: "调度引擎" }, { key: "A", value: "集群代理" }];
    // 创建virtual Notice model
    var vm = yufp.custom.vue({
      el: cite.el,
      data: function () {
        return {
          dialogTableVisible: false,
          loading: null,
          tableData: [],
          deployList: [],
          pageable: false,
          serviceFormData: {
            serverId: '',
            serverName: '',
            serverType: '',
            srvPort: ''
          },
          //导入导出的data  start
          exportList: [],//导出的节点列表
          importFnButton: !yufp.session.checkCtrl('importFn'),
          exportFnButton: !yufp.session.checkCtrl('exportFn'),
          upLoadDialogVisible: false,//是否显示导入页面
          upLoadUrl: yufp.service.getUrl({ url: "api/file/provider/uploadfile" }),//导入的url
          appUploadDatas: [],//文件列表
          showHeader: false,//是否显示错误表头
          errshow: false,//显示导入的错误信息，默认不显示
          excelloading: false,//导入的loading
          errdata: [],//导入的错误信息
          multipleFalg: false,//是否允许多文件
          //导入导出的data  end  

          currentVertex: null,
          height: size.height - 80,
          showInherit: false,
          baseData: [],
          serverTypeOptions: serverTypeOptions,
          isServerNodeFlag: false,
          serverIDDisabled: false, // 标注模块代码是否可编辑
          operation: '0', // 0新增按钮点击，1节点双击编辑信息
          serverType: ['S', 'C', 'A', 'N'], // 节点类型，注意有顺序的
          addServiceDisabled: false, //服务模块信息是否能新增
          portDisabled: false,//处理中央节点端口号不能修改
          activeTabName: "basicInfo",
          paramcfgDatas: [],
          disabledTabPane: false,
          tabsValue: 'xtree', // mxgraph | xtree
          filterText: '',
          rootId: '0',
          renderCustomContent: function (h, obj) {
            var data = obj.data, store = obj.store, node = obj.node, btnArray = [];
            if (data.serverType != 'N' && data.serverType != 'C') {
              btnArray.push({ name: '增加', callback: function () { vm.addBtnClickFn({ data: data }); } })
            }
            btnArray.push({ name: '修改', callback: function (e) { vm.celldblclickFn({ data: data }); } })
            btnArray.push({
              name: '删除',
              callback: function () {
                vm.delclickFn({ data: data });
                vm.hiddenTreeBtn();
              }
            })
            btnArray.push({
              name: '导出',
              callback: function () {
                vm.addexportFn({ data: data });
                vm.hiddenTreeBtn();
              }
            })
            return h('div', { class: 'tree-btn' }, btnArray.map(function (item) {
              return h('span', { on: { click: item.callback } }, item.name)
            }))
          },
          infoLoading: false,
          exportLoading: false
        };
      },
      watch: {
        tabsValue: function (value, oldValue) {
          console.log(value);
          this.disabledTabPane = true;
          this.queryAllDeployInfo();
        },
        filterText: function (val) {
          this.$refs.moduleTree && this.$refs.moduleTree.filter(val);
        }
      },
      created: function () {
        this.queryAllDeployInfo();
      },
      methods: {
        //点击导出模板操作
        exportDemo: function () {
          var _this = this;
          var condition = { busiType: "SERVER" };
          var search = _this.searchFormdata;
          yufp.util.download("api/use/excel/exportTempExcel?condition="
            + encodeURI(JSON.stringify(condition)));
        },
        //点击导出操作
        exportFlowFn: function () {
          var _this = this;
          _this.exportLoading = true;
          var condition = { busiType: "SERVER" };
          condition.exportList = _this.exportList;
          yufp.service.request({
		  method: 'POST',
		  url: '/api/use/excel/exportExcelForWeb',
            data: { condition: condition},
            callback: function (code, message, response) {
              _this.exportLoading = false;
              if (response.code === 0) {
                yufp.util.download("api/use/excel/downLoadExcel?filePath=" + response.data.allFilePath + "&fileName=" + response.data.fileName);
              } else {
                this.$message.error('导出失败');
              }
            }
          });
        },
        importFlowFn: function () { //点击导入操作
          this.upLoadDialogVisible = true;
          this.$nextTick(function () {
            this.$refs['my-upload'].clearFiles();
            this.errshow = false;
            this.errdata = [];
          })
        },
        /**
         *导入前的检验操作操作
         */
        checkUpload: function (file) {
          //alert(file);

          var isLt10M = file.size / 1024 / 1024 < 100;
          if (!isLt10M) {
            this.$message.error('上传文件大小不能超过 100MB!');
          }
          var index = file.name.lastIndexOf('.');
          var ext = file.name.substr(index + 1);

          var suffixValid = ('xlsx' === ext || 'xls' === ext);
          if (!suffixValid) {
            this.$message.error('上传文件的格式必须为excel格式');
            return false;
          }
          return isLt10M && suffixValid;
        },
        successUpload: function (response, file, fileList) { //导入成功后执行
          /*	console.log('上传成功！')
            this.$refs['my-upload'].clearFiles();*/


          const _this = this;
          const param = {};
          /* 					_this.$loading({
                      target:'.load-target',
                      body:true
                    }) */
          _this.excelloading = true;
          param.busiType = "SERVER";
          param.excelUpLoadFile = response.data;
          yufp.service.request({
            method: 'POST',
            url: '/api/use/excel/importExcel',
            data: param,
            timeout: 1800000,
            callback: function (code, message, response) {
              _this.excelloading = false;
              if (response.code == 0 && response.data.errorInfos.length == 0 && response.data.impStatus != '失败') {
                _this.$refs['my-upload'].clearFiles();
                _this.errshow = false;
                _this.errdata = [];
                _this.upLoadDialogVisible = false;
                _this.$message('导入成功!');
                //同时重新查询列表
                _this.queryAllDeployInfo(); //重新加载模块树

              } else {
                _this.errshow = true;
                _this.$refs['my-upload'].clearFiles();
                _this.errdata = [];
                if (response.data && response.data.errorInfos.length > 0 && response.data.errorInfos[0].errorList) {
                  response.data.errorInfos[0].errorList.map(function (item, index) {
                    _this.errdata.push({
                      "errMsg": item
                    })
                  })
                } else {
                  _this.errdata.push({
                    "errMsg": response.message
                  })
                }

              }
            }
          });
        },
        queryAllDeployInfo: function () {
          var _this = this;
          yufp.service.request({
            // url: backend.useService + '/plats/serverdeploy/queryList',
            url: backend.useService + '/plats/serverdeploy/queryAllDeployInfo',
            method: 'get',
            data: null,
            callback: function (code, message, response) {
              if (response && response.data) {
                var baseData = [];
                if (response.data.length > 0) {
                  baseData = response.data;
                } else if (response.data.datas.length > 0) {
                  baseData = response.data.datas;
                }
                _this.setBaseData(baseData);
                // if (_this.tabsValue === 'mxgraph') {
                //   _this.$refs.workflow.addStyle({
                //     'S': '#cfb1ed',
                //     'C': '#FFFFCF',
                //     'A': '#B8C9EC',
                //     'N': '#A5CB72'
                //   });
                //   var classification =  _this.getClassification( _this.baseData);
                //   _this.$refs.workflow.loadData( _this.baseData, {
                //     types: {
                //       'S': 0,
                //       'C': 1,
                //       'A': 2,
                //       'N': 3,
                //     },
                //     classification: classification
                //   });
                // }
                setTimeout(function () {
                  _this.disabledTabPane = false;
                }, 600);
              }
            }
          });
        },
        setBaseData: function (baseData) {
          var _this = this;
          var treeData = _this.arrayToTree(baseData);
          if (treeData.length > 0) {
            _this.rootId = treeData[0].serverId;
          }
          baseData.forEach(function (item) {
            item.label = item.serverName + '（' + item.serverId + '）';
            item.icon = 'server-type-' + item.serverType;
            if (treeData[0].children) {
              if (item.serverId === treeData[0].serverId) {
                item.label = item.serverName + '（' + item.serverId + '）' + '（' + treeData[0].children.length + '）';
              } else {
                treeData[0].children.forEach(function (treeitem) {
                  if (item.serverId === treeitem.serverId && treeitem.children) {
                    item.label = item.serverName + '（' + item.serverId + '）' + '（' + treeitem.children.length + '）';
                  }
                })
              }
            }
          })
          _this.baseData = baseData;
        },
        arrayToTree: function (list) {
          var arr = [];
          var tmpMap = {};
          list.forEach(function (item) {
            tmpMap[item['serverId']] = item;
          });
          list.forEach(function (item) {
            var key = tmpMap[item['parentId']];
            if (key) {
              if (!key['children']) {
                key['children'] = [];
              }
              key['children'].push(item);
            } else {
              arr.push(item);
            }
          })
          return arr;
        },
        filterNode: function (value, data) {
          if (!value) {
            return true;
          }
          return data.label.toLowerCase().indexOf(value.toLowerCase()) !== -1;
        },
        nodeDbclick: function (data, node) {
          this.celldblclickFn({ data: data });
        },
        hiddenTreeBtn: function () {
          document.querySelector('.serviceModuleDeploy .el-tree .tree-btn').style.display = 'none';
        },
        nextStep: function () {
          var _this = this;
          var locationArr = [];//部署位置数组
          var result = this.$refs.serviceForm.validate(function (valid) {
            if (!valid) {
              return false;
            };
            if (_this.deployList.length === 0) {
              _this.$message({ message: '至少部署一个服务地址', type: "warning" });
              return false;
            };
            // 校验端口号是否规范
            if (_this.serviceFormData.srvPort < 16005 || _this.serviceFormData.srvPort > 65535) {
              _this.$message({ message: '端口号范围为16005-65535，请定义规范的端口号', type: "warning" });
              return false;
            }
            // 校验部署位置是否重复
            for (item of _this.deployList) {
              if (item.location == null || item.location == "") {
                _this.$message({ messsage: '端口号范围为16005-65535，请定义规范的端口号', type: "warning" });
                return false;
              } else {
                locationArr.push(item.location);
              }
            }

            var locationArrTem = Array.from(new Set(locationArr));
            if (locationArrTem.length < locationArr.length) {
              _this.$message({ messsage: '部署位置不能重复', type: "warning" });
              return false;
            }

            if (_this.operation === '0') {
              var selectedCellData = _this.currentVertex.data;
              _this.serviceFormData.serverType = _this.serverType[_this.serverType.indexOf(selectedCellData.serverType) + 1];
            }

            _this.queryWftServerParam(_this.serviceFormData, locationArrTem);
          });


        },

        /* showParameters: function(){
           if(this.activeTabName==='paramInfo'){
             this.queryWftServerParam(this.serviceFormData,[]);
           }
         },*/

        lastStep: function () {
          this.activeTabName = "basicInfo";
        },

        overLayClickFn: function (overlay, cell) {
          this.$message(cell.data.serverName + ':' + overlay.tooltip);
        },
        showLoading: function () {
          var _this = this;
          this.loading = this.$loading({
            body: true
          })
          /* 去除延时关闭遮盖
          setTimeout(function () {
            _this.closeLoading();
          }, 5000);*/
        },
        closeLoading: function () { this.loading.close() },
        data2CellData: function () {
          var nodeList = [], edgeList = [], width = this.size.width;
          var typeList = options.classification;
          for (var i = 0, l = data.length, d; i < l; i++) {
            d = yufp.clone(data[i], {});
            d['nodetype'] = d.serverType;
            nodeList.push({
              id: d.serverId,
              value: d.serverName,
              // x: (width - 200) / 2 + 200 * typeList[d.serverType],
              // y: 30 + 75 * options.types[d.serverType],
              x: 0,
              y: 0,
              width: 160,
              height: 56,
              style: 'custom-style-' + d.serverType,
              relative: false,
              nodetype: d.serverType,
              data: d
            })
            if (d.parentId && d.parentId !== '0') {
              edgeList.push({
                id: d.parentId + '-' + d.serverId,
                // value: 'edge-' + i,
                value: '',
                source: d.parentId,
                target: d.serverId
              });
            }
          }
        },
        btnUpdateWorkFlowFn: function () {
          this.baseData.forEach(function (item) {
            item.state = ['Init', 'Completed', 'Running', 'Waiting'][Math.round(Math.random() * 3)]
          })
          this.$refs.workflow.updateWorkStates(this.baseData);
        },
        btnZoominGraph: function () {
          this.$refs.workflow.graphZoom(1);
        },
        btnZoomoutGraph: function () {
          this.$refs.workflow.graphZoom(-1);
        },
        /**
         * @description 获取分类信息
         * @param {Array<Object>} list 数据列表
         */
        getClassification: function (list) {
          if (list && list.length > 0) {
            var typeList = {};
            for (var i = 0, l = list.length; i < l; i++) {
              typeList[list[i].serverType] = (typeList[list[i].serverType] || 0) + 1;
            }
            return typeList;
          }
          return null;
        },
        showDialog: function () {
          this.dialogTableVisible = true;
        },
        celldblclickFn: function (cell) {
          var _this = this;
          this.paramcfgDatas.splice(0);
          if (cell.vertex || this.tabsValue === 'xtree') {
            this.serverIDDisabled = true;
            this.operation = '1';
            this.currentVertex = cell;
            this.portDisabled = false;
            this.isServerNodeFlag = false;
            this.infoLoading = true;
            // 根据节点类型特殊处理是否能新增 N类型 模块只能有条数据
            if (cell.data.nodetype === 'N' && cell.data.deployList.length >= 1) {
              this.addServiceDisabled = true;
            } else {
              this.addServiceDisabled = false;
            }
            this.showDialog();
            var data = cell.data;
            this.activeTabName = "basicInfo";

            var list = data.deployList;
            _this.deployList = [];
            list.forEach(function (item, index) {
              var row = yufp.clone(item);
              _this.deployList.push(row);

            });

            this.$nextTick(function () {
              _this.$refs.serviceForm.resetFields();
              _this.$refs.serviceForm.setFormData(data);

              _this.queryWftServerParam(_this.serviceFormData, []);

            })
          }
        },
        addServiceData: function () {
          this.deployList.push({ location: '', deployDesc: '' });
        },
        rmServiceData: function () {
          // this.deployList.pop();
          var _this = this;
          var selections = _this.$refs.serTable.selections;
          if (selections.length != 1) {
            _this.$message.error("请选择一条数据！");
            return;
          }
          var data = this.deployList;
          data.forEach(function (item, index) {
            if (item.location === selections[0].location) {
              data.splice(index, 1);//删除
            }
          });
          // _this.deployList.splice(selections[0].$index,1);
          if (this.deployList.length < 1) {
            // N类型的节点在服务模块数少于1时可以新增
            this.addServiceDisabled = false;
          }
        },

        saveParamInfo: function () {
          var _this = this;
          var data = yufp.clone(_this.serviceFormData);
          data.deployList = mxUtils.clone(_this.deployList);
          data.params = _this.paramcfgDatas;

          yufp.service.request({
            url: backend.useService + '/plats/serverdeploy/saveServerParams',
            method: 'post',
            data: JSON.stringify(data),
            callback: function (code, message, response) {
              if (code === 0) {
                var resData = response.data;
                if (resData) {
                  _this.$message("操作成功");
                  _this.hidePopWindow();
                } else {
                  _this.$message.error(response.message);
                }
              } else {
                _this.$message(message);
              }
              // _this.closeLoading();
            }
          })
        },

        saveInfo: function () {
          var _this = this;
          var locationArr = [];//部署位置数组
          this.$refs.serviceForm.validate(function (valid) {
            if (!valid) {
              return false;
            };
            if (_this.deployList.length === 0) {
              _this.$message({ message: '至少部署一个服务地址', type: "warning" });
              return false;
            };
            // 校验端口号是否规范
            if (_this.serviceFormData.srvPort < 16005 || _this.serviceFormData.srvPort > 65535) {
              _this.$message({ message: '端口号范围为16005-65535，请定义规范的端口号', type: "warning" });
              return false;
            }
            // 校验部署位置是否重复
            for (item of _this.deployList) {
              if (item.location == null || item.location == "") {
                _this.$message({ message: '部署位置不能为空', type: "warning" });
                return false;
              } else {
                locationArr.push(item.location);
              }
            }

            var locationArrTem = Array.from(new Set(locationArr));
            if (locationArrTem.length < locationArr.length) {
              _this.$message({ message: '部署位置不能重复', type: "warning" });
              return false;
            }

            _this.showLoading();
            var data = yufp.clone(_this.serviceFormData);
            data.deployList = mxUtils.clone(_this.deployList);
            //data.params = _this.paramcfgDatas;
            if (_this.operation === '0') { // 0新增，1修改
              var selectedCellData = _this.currentVertex.data;
              data.parentId = selectedCellData.serverId || '';
              if (_this.serviceFormData.serverType == undefined ||
                _this.serviceFormData.serverType === null ||
                _this.serviceFormData.serverType === '') {
                data.serverType = _this.serverType[_this.serverType.indexOf(selectedCellData.serverType) + 1];
              } else {
                data.serverType = _this.serviceFormData.serverType;
              }
			  if(selectedCellData.serverType=='A'){
				  data.serverType='N';
			  }
              data.parentName = selectedCellData.serverName || '';
            }
            delete data.custom;
            yufp.service.request({
              url: backend.useService + '/plats/serverdeploy/' + (_this.operation === '0' ? 'saveServerModule' : 'updateServerModule'),
              method: 'post',
              data: JSON.stringify(data),
              callback: function (code, message, response) {
                if (code === 0) {
                  var resData = response.data;
                  if (resData) {
                    switch (_this.tabsValue) {
                      case 'mxgraph':
                        if (_this.operation === '0') {
                          var cell = _this.$refs.workflow.addVertex(null, resData.serverId, resData.serverName, 0, 0, 0, 0, 'custom-style-' + resData.serverType, false, resData);
                          _this.$refs.workflow.addEdge(null, {
                            source: _this.currentVertex.id,
                            target: cell.id,
                            id: _this.currentVertex.id + '-' + cell.id,
                            value: ''
                          });
                          _this.getClassification([cell]);
                        } else {
                          data = yufp.clone(_this.serviceFormData);
                          data.deployList = mxUtils.clone(_this.deployList);
                          _this.$refs.workflow.updateVertex(_this.currentVertex, data.serverName, data);
                        }
                        break;
                      case 'xtree':
                        var baseData = _this.baseData;
                        if (_this.operation === '0') {
                          baseData.push(resData);
                        } else {
                          data = yufp.clone(_this.serviceFormData);
                          data.deployList = mxUtils.clone(_this.deployList);
                          baseData.forEach(function (item, index) {
                            if (item.serverId === data.serverId) {
                              baseData.splice(index, 1, data);
                            }
                          });
                        }
                        //同时重新查询列表
                        _this.queryAllDeployInfo(); //重新加载模块树
                        _this.setBaseData(baseData);
                        break;
                      default:
                        break;
                    }
                    _this.hidePopWindow();
                  } else {
                    _this.$message.error(response.message);
                  }
                } else {
                  _this.$message(message);
                }
                _this.closeLoading();
              }
            })
          });
        },
        hidePopWindow: function () {
          this.dialogTableVisible = false;
          this.$refs.serviceForm.resetFields();
        },
        // 增加节点
        addBtnClickFn: function (cell) {

          if (cell.data.serverType === 'S' && (cell.data.srvPort == '' || cell.data.srvPort == null)) {
            this.$message({ message: "请先设置中央监控信息", type: "warning" });
            return;
          }

          var _this = this;
          this.currentVertex = cell;
          this.serverIDDisabled = false;
          this.operation = '0';
          this.showInherit = cell.serverType === 'C';
          this.isServerNodeFlag = cell.data.serverType === 'S';
          _this.activeTabName = "basicInfo";
          _this.portDisabled = false;
          this.showDialog();
          this.$refs.serviceForm && this.$refs.serviceForm.resetFields();
          this.deployList = [];
          // this.addServiceDisabled= false;
          this.$nextTick(function () {
            _this.serviceFormData.serverId = _this.getUID();
            // _this.queryWftServerParam({});
          });
        },
        btnSaveGraph: function () {
          var _this = this;
          yufp.service.request({
            url: backend.useService + '/plats/serverdeploy/saveFlowContent',
            method: 'post',
            data: JSON.stringify({
              flowContent: this.$refs.workflow.exportXML(),
              remark: this.getWorkFlowCells().length
            }),
            callback: function (code, message, response) {
              console.log('保存图的xml成功', arguments);
              _this.$message('保存成功！');
            }
          });
        },
        queryWftServerParam: function (data, locations) {
          var _this = this;
          //data = yufp.clone(_this.serviceFormData);
          var deploys = [];
          for (let i = 0; i < locations.length; i++) {
            deploys.push({ location: locations[i] });
          }
          data.deployList = deploys;
          yufp.service.request({
            method: 'POST',
            url: "api/use/plats/serverdeploy/queryParamList",
            data: JSON.stringify(data),
            callback: function (code, message, response) {
              if (response.code != 0) {
                _this.$message(response.message);
              } else {
                if (data.serverType === 'S' && response.message != '') {
                  _this.serviceFormData.serverId = response.message;
                }
                //_this.activeTabName = "paramInfo";
                _this.$nextTick(function () {
                  _this.paramcfgDatas.splice(0);
                  for (let i = 0; i < response.data.length; i++) {
                    _this.paramcfgDatas.push(response.data[i]);
                  }
                })
              }
              _this.infoLoading = false;
            }
          });
        },

        // 获取流程图所有节点数
        getWorkFlowCells: function () {
          var cs = this.$refs.workflow.graph.getModel().cells;
          var cells = [];
          for (var k in cs) {
            if (cs[k].vertex) {
              cells.push(cs[k]);
            }
          }
          return cells;
        },
        /*默认由后台生成*/
        getUID: function () { // 获取唯一值
          /* return 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
               var r = Math.random()*16|0, v = c == 'x' ? r : (r&0x3|0x8);
               return v.toString(16);
           });*/
          return "";
        },
        delclickFn: function (cell) {
          var _this = this;
          var msg = '确定移除此模块?';
          if (cell && cell.data && cell.data.serverName) {
            msg = '确定移除 "' + cell.data.serverName + '" 模块?';
          }
          var data = [];
          var cellList = [];
          if (_this.tabsValue === 'mxgraph') {
            var cells = _this.$refs.workflow.getChildCells(cell, false);
            // 多节点级联删除
            for (var k in cells) {
              // 默认只传递删除节点
              if (cells[k].vertex) {
                data.push({
                  serverId: cells[k].data.serverId,
                  serverType: cells[k].data.serverType
                })
                cellList.push(cells[k]);
              }
            }
          } else {
            _this.baseData.forEach(function (item, index) {
              if (item.parentId === cell.data.serverId || item.serverId === cell.data.serverId) {
                data.push({
                  serverId: item.serverId,
                  serverType: item.serverType
                })
              }
            })
          }
          _this.$confirm(msg, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning', duration: 6000,
            callback: function (action) {
              if (action === 'confirm') {
                _this.showLoading()
                yufp.service.request({
                  url: backend.useService + '/plats/serverdeploy/deleteServerModule',
                  method: 'delete',
                  data: JSON.stringify(data),
                  callback: function (code, message, response) {
                    if (code === 0) {
                      if (_this.tabsValue === 'mxgraph') {
                        _this.$refs.workflow.delVertex(cellList);
                      } else {
                        var baseData = [];
                        _this.baseData.forEach(function (item) {
                          if (item.parentId !== cell.data.serverId && item.serverId !== cell.data.serverId) {
                            baseData.push(item);
                          }
                        });
                        _this.setBaseData(baseData);
                      }
                      _this.$message('删除成功!');
                      //同时重新查询列表
                      _this.queryAllDeployInfo(); //重新加载模块树
                    } else {
                      _this.$message(message);
                    }
                    _this.closeLoading()
                  }
                })
              }
            }
          });
        },
        //删除导出
        deleteFn: function (cell) {
          var oldList = this.exportList || [];
          var newList = [];
          oldList.map(function (item, idx) {
            if (cell.$index !== idx) {
              newList.push(item);
            }
          })
          this.exportList = newList;
        },
        //增加导出
        addexportFn: function (cell) {
          var oldList = this.exportList || [];
          var ob = { 'serverId': cell.data.serverId, 'serverType': cell.data.serverType, 'serverName': cell.data.serverName, 'srvPort': cell.data.srvPort }
          var flag = false;
          for (var item in oldList) {
            if (oldList[item].serverId === ob.serverId && oldList[item].serverName === ob.serverName && oldList[item].srvPort === ob.srvPort && oldList[item].serverType === ob.serverType) {
              flag = true;
            }
          }
          if (flag) {
            return;
          }
          oldList.push(ob);
          this.exportList = oldList;
        },
        //excel导出
        exportFn: function () {




        },
        exportClearFn: function () {
          this.exportList = [];
        }
      }
    });
  };
  // 消息处理
  exports.onmessage = function (type, message) { };
  // page销毁时触发destroy方法
  exports.destroy = function (id, cite) { };
});